export default{
	//  获取url参数
	getQueryString(name){
		let reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)","i");
        if(reg.test(window.location.href)){
            return unescape(RegExp.$2.replace(/\+/g," "));
        }
        return undefined
	},
	
	// 获取cookie
	getCookie(name){
			var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
			if(arr=document.cookie.match(reg))
			return unescape(arr[2]);
			else
			return null;
	},
	
	// 设置localStorage
	setLocalStorage(key,value){
		if(value){
			 localStorage.setItem(key,value);
		}else{
			console.log('setLocalStorage_err!!!');
		}
	},
	
	// 获取localStorage
	getLocalStorage(key){
		let value = localStorage.getItem(key);
		if(value){
			return value;
		}else{
			return null;
		}
	},

	// 设置sessionstorage
	setSessionStorage(key,value){
		if(value){
			 sessionStorage.setItem(key,value);
		}else{
			console.log('sessionStorage_err!!!');
		}
	},

	// 获取sessionStorage
	getSessionStorage(key){
		let value = sessionStorage.getItem(key);
		if(value){
			return value;
		}else{
			return null;
		}
	},

	// 验证是否为手机号
	isPoneAvailable(telNo){
		let myreg=/^[1][3,4,5,7,8][0-9]{9}$/;  
		if (!myreg.test(telNo)) {  
			return false;  
		} else {  
			return true;  
		}  
	}
}